#!/usr/bin/env python
# coding: utf-8

# from test.redis.py2 import rdc
from test.freeswitch.pro.cloudcallRedis import rdc
import json,time
from typing import Dict, Union
from datetime import datetime, timedelta
# rdc.get_state()
# print("none city:"+rdc.get_cop_num('20358'))
# print("has city:" + rdc.get_cop_num('20358','1'))
cif = rdc.get_last_call_info('LastCallInfo:02023398853:13724059427')

pwi = cif[b'popupWindowId']
pwi = json.loads(cif[b'popupWindowId'])
print(pwi)
print(pwi['projectName'])
print(cif)

#
# call_info_dict: Dict[str, Union[str, Dict[str, str]]] = {
#     'cityId': 'X_city',
#     'dataId': 'X_data_id',
#     'enrollNum': 'X_enroll_num',
#     'userId': 'X_create_user_id',
#     'direct_call': 'true'
# }
#
# p_dict = {
#     'mainCallPhone':'ttt',
#     'targetCallPhone': 'args',
#     'commitTime': time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
#     'callTaskId': 'X_callTask_id',
#     'packageId': 'X_package_id',
#     'whereFrom': 'X_where_from',
#     'pageFrom': 'X_page_from',
#     'projectName': 'X_project_name',
#     'customerName': 'X_customer_name',
#     'customerNo': 'X_customer_no'
# }
# call_info_dict['popupWindowId'] = json.dumps(p_dict)
#
# print(call_info_dict)
#
# print(rdc.add_last_call_info('02023399029','13724059427',call_info_dict))

X_callTask_id = None
print(X_callTask_id if X_callTask_id is not None else "-1")

show_num = "02038887777"
print(show_num)
show_num = show_num.encode('utf-8')
print(show_num)


dit= {
   'mainCallPhone':  '\\\"'+'ttt'+'\\\"',
   'targetCallPhone':  '\\\"'+'args'+'\\\"'
}
print(json.dumps(dit))

"\"{\\\"mainCallPhone\\\":\\\""+show_num+"\\\",\\\"commitTime\\\":\\\"2020-01-11 13:23:44\\\",\\\"callTaskId\\\":\\\"0\\\",\\\"targetCallPhone\\\":\\\"13724059427\\\",\\\"packageId\\\":\\\"0\\\",\\\"pageFrom\\\":\\\"2\\\",\\\"customerName\\\":\\\"1111\\\",\\\"customerNo\\\":\\\"GZR02000731\\\"}\""